//
//  HJNetworking.h
//  KaiChat
//
//  Created by lx on 2023/10/16.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

NSURLSessionDownloadTask * HJDownloadFileWithUrl(NSString *url,void (^progress)(CGFloat value), NSURL *(^destination)(void), void (^complete)(NSError * _Nullable error));
 
#define reCaptchaVerifyCode 1154
#define notSetPasswordCode 4014
#define selfNotBindingAccountCode 1700
#define otherNotBindingAccountCode 1701
#define groupNotExistCode 1409
#define groupDisbandCode 1407

@interface HJNetworking : NSObject

+ (HJNetworking *)shareNetwork;

- (void)POST:(NSString *)url
  parameters:(nullable id)parameters
     success:(void (^__nullable)(NSDictionary *responseObject, id data))success
     failure:(void (^__nullable)(NSError *error))failure;

- (void)POSTBodyJSON:(NSString *)url
  parameters:(nullable id)parameters
     success:(void (^__nullable)(NSDictionary *responseObject, id data))success
     failure:(void (^__nullable)(NSError *error))failure;

- (void)GET:(NSString *)url
 parameters:(nullable id)parameters
    success:(void (^__nullable)(NSDictionary *responseObject, id data))success
    failure:(void (^__nullable)(NSError *error))failure;

- (void)uploadImageWithObejctKey:(NSString *)obejctKey fileData:(NSData *)fileData progress:(nullable void (^)(int64_t totalUnitCount, int64_t completedUnitCount))uploadProgress success:(void (^)(NSString *url))success failure:(void (^)(NSError *error))failure;

AFHTTPSessionManager * getBodyJsonHTTPSessionManager(void);


- (void)tokenError;

@end


NS_ASSUME_NONNULL_END
